/**********************************************************************************
// Timer Source File
// 
// Creation:	01 Jun 2011
// Updated:		01 Jun 2011
// Compiler:	Visual Studio 2010
//
// Notes:		Time tracking class
//
**********************************************************************************/

#include "Timer.h"

/**********************************************************************************/
// constructor

Timer::Timer()
{
	// get frequency of high performance counter
	QueryPerformanceFrequency(&freq);

	ZeroMemory(&start, sizeof(start));
	ZeroMemory(&end, sizeof(end));
}

/**********************************************************************************/
// start timer

void Timer::Start()
{
	QueryPerformanceCounter(&start);
}

/**********************************************************************************/
// get elapsed time in seconds

float Timer::Elapsed()
{
	QueryPerformanceCounter(&end);
	llong elapsedTime = end.QuadPart - start.QuadPart;

	return float(elapsedTime / double(freq.QuadPart));
}

/**********************************************************************************/